<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core">

<ui:composition template="/WEB-INF/template/template.xhtml">
	<ui:define name="content">
		<f:view>
			<h:form>
				<br />
				<div class="middle">
					<h2>
						<h:outputText value="#{msg.AD_domainCrud_domains}" />
					</h2>
				</div>
				<br />
				<div class="middle">
					<h:messages class="myError"></h:messages>
				</div>
				<br />
				<div class="middle">
					<h:outputText id="error" value="#{domainBean.message}"></h:outputText>
				</div>
				<br />
				<h:panelGrid id="renderpage" class="panelGrid" columns="1">

					<h:dataTable id="table" class="table"
						value="#{domainBean.domainsList}" var="domain">
						<h:column>
							<f:facet class="th" name="header">
								<h:outputText value="#{msg.AD_domainCrud_domain}"></h:outputText>
							</f:facet>
							<h:outputText class="td" value="#{domain.name}"></h:outputText>
						</h:column>

						<h:column>
							<f:facet class="th" name="header">
								<h:outputText value="#{msg.AD_domainCrud_edit}"></h:outputText>
							</f:facet>
							<h:commandButton class="editBtn" actionListener="#{domainBean.editListner}"
								value="#{msg.AD_domainCrud_edit}" immediate="true" action="#{domainBean.refresh}">
								<f:attribute name="domainID" value="#{domain.id}" />
							</h:commandButton>
						</h:column>

						<h:column>
							<f:facet class="th" name="header">
								<h:outputText value="#{msg.AD_domainCrud_delete}"></h:outputText>
							</f:facet>
							<h:commandButton class="trashBtn"
								value="#{msg.AD_domainCrud_delete}" immediate="true"
								actionListener="#{domainBean.removeListner}"
								onclick="#{msg.TG_ticketDetail_confMessage}" render="table">
								<f:attribute name="domainID" value="#{domain.id}" />
							</h:commandButton>
						</h:column>

					</h:dataTable>
					<br />
					<center>
						<h:panelGrid>

							<h:outputFormat>
								<h:outputText value="#{msg.AD_domainCrud_domainName}"></h:outputText>
							</h:outputFormat>
							<h:inputText id="nameField"
								label="#{msg.AD_domainCrud_domainName}" name="nameField"
								value="#{domainBean.domainDto.name}">
								<f:validator validatorId="validators.DomainValidator"></f:validator>
								<f:validator validatorId="validators.DomainDoublicateValidator"></f:validator>
							</h:inputText>

							<h:panelGroup id="editPanel" rendered="#{domainBean.editVisible}">

								<h:commandButton class="button"
									value="#{msg.AD_domainCrud_applyChanges}"
									actionListener="#{domainBean.doUpdate}"
									onclick="#{msg.TG_ticketDetail_confMessage}" render="@all">
									<f:attribute name="domainID" value="#{domain.id}" />
								</h:commandButton>
							</h:panelGroup>
							<h:panelGroup id="newPanel" rendered="#{domainBean.addVisible}">
								<h:commandButton class="button"
									value="#{msg.AD_domainCrud_addDomain}"
									actionListener="#{domainBean.doAdd}"
									onclick="#{msg.AD_domainCrud_confMessage}" render="@all">
									<f:attribute name="domainID" value="#{domain.id}" />
								</h:commandButton>
							</h:panelGroup>

						</h:panelGrid>
					</center>
				</h:panelGrid>
			</h:form>
		</f:view>
	</ui:define>
</ui:composition>
</html>


